﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetPE.Core.DataDirectories;

namespace NetPE.TreeNodes
{
    public class CLRDNode : BaseNode
    {
        public CLRDNode(DataDirectory hdr)
            : base(hdr) 
        {
            this.hdr = hdr as CLRDirectory;
            this.Text = "CLR Directory";
            this.ImageIndex = this.SelectedImageIndex = NodeType.Directory;
            this.Nodes.Add(new CLRDatsNode(this.hdr.Datas));
            this.Nodes.Add(new MdRootNode(this.hdr.Metadata));
            this.Nodes.Add(new ByteArrNode(this.hdr.Resources, "Resources"));
            this.Nodes.Add(new ByteArrNode(this.hdr.StrongNameSignature, "Strong Name Signature"));
            this.Nodes.Add(new ByteArrNode(this.hdr.CodeManagerTable, "Code Manager Table"));
            //VTableFixup
            this.Nodes.Add(new ByteArrNode(this.hdr.ExportAddressTableJumps, "Export Address Table Jumps"));
            this.Nodes.Add(new ByteArrNode(this.hdr.ManagedNativeHeader, "Managed Native Header"));
        }

        CLRDirectory hdr;
        public override object Data { get { return hdr; } }

        public override BaseEditor GetEditorControl()
        {
            return new CLREditor(this);
        }
    }
}
